<?php
declare (strict_types = 1);

namespace app\api\model\v1;

use think\Model;

/**
 * @mixin \think\Model
 */
class TopicExerciseLog extends AppModel
{

    //题型：1判断题，2单选题，3多选题，4填空题，5问答题
    const TOPIC_ONE = 1;
    const TOPIC_TWO = 2;
    const TOPIC_THREE = 3;
    const TOPIC_FOUR = 4;
    const TOPIC_FIVE = 5;


    public static $is_topic = array(
        self::TOPIC_ONE => '判断题',
        self::TOPIC_TWO => '单选题',
        self::TOPIC_THREE => '多选题',
        self::TOPIC_FOUR => '填空题',
        self::TOPIC_FIVE => '问答题',

    );


    //
    public function option()
    {
        return $this->hasMany(LearnOption::class,'learn_topic_id','learn_topic_id');
    }

    public function user(){
        return $this->belongsTo(Users::class,'exercise_user_id')->field('id,nickname,unit_id');
    }
}
